package com.stellar.wechat.core.common.exception;

import com.stellar.wechat.core.enums.WxErrorCode;

/**
 * 微信接口异常
 */
public class WxApiException extends RuntimeException {

    private final int errcode;

    private final String errmsg;

    public WxApiException(int errcode, String errmsg) {
        super(errmsg);
        this.errcode = errcode;
        this.errmsg = errmsg;
    }

    public WxApiException(WxErrorCode errorCode) {
        super(errorCode.getDesc());
        this.errcode = errorCode.getCode();
        this.errmsg = errorCode.getDesc();
    }

    public int getErrcode() {
        return errcode;
    }

    public String getErrmsg() {
        return errmsg;
    }
}